<!DOCTYPE html>
<html>
  <head>
  <meta charset='UTF-8'>
  <title>Atom API Documentation</title>
  <link rel='stylesheet' href='../assets/biscotto.css' type='text/css'>
  <script src='../assets/biscotto.js'></script>
  <script src='../assets/search_data.js'></script>
</head>
  <body>
    <div id='base' data-path='..&#47;'></div>
<div id='header'>
  <div id='menu'>
    <a href='../docs/README.md.html' title='Atom'>Atom</a>
    &raquo;
    <a href='../class_index.html' title='Index'>Index</a>
    &raquo;
    <span class='title'>TextBuffer</span>
    <nav>
      <ul>
        <li class='noframes'>
          (<a class='noframes' href='TextBuffer.html#'>no frames</a>)
        </li>
      </ul>
    </nav>
    <div id='search'>
      <a id='class_list_link' href='../class_list.html'>Classes</a>
      <a id='file_list_link' href='../file_list.html'>Files</a>
      <a id='method_list_link' href='../method_list.html'>Methods</a>
      <a id='extra_list_link' href='../extra_list.html'>Extras</a>
    </div>
  </div>
  <iframe id='search_frame'></iframe>
  <div id='fuzzySearch'>
    <input type='text'>
    <ol></ol>
  </div>
  <div id='help'>
    <p>
      Quickly fuzzy find classes, mixins, methods, file:
    </p>
    <ul>
      <li>
        <span>Ctrl-T</span>
        Open fuzzy finder dialog
      </li>
    </ul>
    <p>
      In frame mode you can toggle the list naviation frame on the left side:
    </p>
    <ul>
      <li>
        <span>Ctrl-L</span>
        Toggle list view
      </li>
    </ul>
    <p>
      You can focus a list in frame mode or toggle a tab in frameless mode:
    </p>
    <ul>
      <li>
        <span>Ctrl-C</span>
        Class list
      </li>
      <li>
        <span>Ctrl-I</span>
        Mixin list
      </li>
      <li>
        <span>Ctrl-F</span>
        File list
      </li>
      <li>
        <span>Ctrl-M</span>
        Method list
      </li>
      <li>
        <span>Ctrl-E</span>
        Extras list
      </li>
    </ul>
    <p>
      You can focus and blur the search input:
    </p>
    <ul>
      <li>
        <span>Ctrl-S</span>
        Focus search input
      </li>
      <li>
        <span>Esc</span>
        Blur search input
      </li>
    </ul>
    <p>
      In frameless mode you can close the list tab:
    </p>
    <ul>
      <li>
        <span>Esc</span>
        Close list tab
      </li>
    </ul>
  </div>
</div>
    <div id='content'>
      <h1>
        Class
        TextBuffer
      </h1>
      <div class='stability-1'>
        <span class='heading'></span>
        <div class='message'></div>
      </div>
      <table class='box'>
        <tr>
          <td>Defined in:</td>
          <td>docs&#47;includes&#47;text-buffer&#47;src&#47;text-buffer.coffee</td>
        </tr>
      </table>
      <h2>Overview</h2>
      <div class='docstring'>
  <p>A mutable text container with undo/redo support and the ability to annotate logical regions in the text.</p><h2 id="events">Events</h2>
<ul>
<li><p><code>changed</code> -
   Emitted synchronously whenever the buffer changes. Binding a slow handler
   to this event has the potential to destroy typing performance. Consider
   using <code>contents-modified</code> instead and aim for extremely fast performance
   (&lt; 2 ms) if you must bind to it. Your handler will be called with an
   object containing the following keys.</p><ul>
<li><code>oldRange</code> - The <a href='Range.html'>Range</a> of the old text</li>
<li><code>newRange</code> - The <a href='Range.html'>Range</a> of the new text</li>
<li><code>oldText</code> - A <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a> containing the text that was replaced</li>
<li><code>newText</code> - A <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a> containing the text that was inserted</li>
</ul>
</li>
<li><p><code>markers-updated</code> -
   Emitted synchronously when the <code>changed</code> events of all markers have been
   fired for a change. The order of events is as follows:</p><ul>
<li>The text of the buffer is changed</li>
<li>All markers are updated accordingly, but their <code>changed</code> events are not
emited</li>
<li>The <code>changed</code> event is emitted</li>
<li>The <code>changed</code> events of all updated markers are emitted</li>
<li>The <code>markers-updated</code> event is emitted.</li>
</ul>
</li>
<li><p><code>contents-modified</code> -
   Emitted asynchronously 300ms (or <code>TextBuffer::stoppedChangingDelay</code>)
   after the last buffer change. This is a good place to handle changes to
   the buffer without compromising typing performance.</p></li>
<li><p><code>modified-status-changed</code> -
   Emitted with a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean'>Boolean</a> when the result of <a href='TextBuffer.html#isModified-instance'>::isModified</a> changes.</p></li>
<li><p><code>contents-conflicted</code> -
   Emitted when the buffer&#39;s underlying file changes on disk at a moment
   when the result of <a href='TextBuffer.html#isModified-instance'>::isModified</a> is true.</p></li>
<li><p><code>will-reload</code> -
   Emitted before the in-memory contents of the buffer are refreshed from
   the contents of the file on disk.</p></li>
<li><p><code>reloaded</code> -
   Emitted after the in-memory contents of the buffer are refreshed from
   the contents of the file on disk.</p></li>
<li><p><code>will-be-saved</code> - Emitted before the buffer is saved to disk.</p></li>
<li><p><code>saved</code> - Emitted after the buffer is saved to disk.</p></li>
<li><p><code>destroyed</code> - Emitted when the buffer is destroyed. </p></li>
</ul>

</div>
<div class='tags'>
</div>
      <h2>Instance Method Summary</h2>
      <ul class='summary'>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#abortTransaction-instance'>
        ::<strong>abortTransaction</strong>()
      </a>
    </span>
    <span class='desc'>
      Abort an open transaction, undoing any operations performed so far within the transaction.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#append-instance'>
        Range ::<strong>append</strong>(text, normalizeLineEndings)
      </a>
    </span>
    <span class='desc'>
      Append text to the end of the buffer.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#backwardsScan-instance'>
        ::<strong>backwardsScan</strong>(regex, iterator)
      </a>
    </span>
    <span class='desc'>
      Scan regular expression matches in the entire buffer in reverse order, calling the given iterator function on each match.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#backwardsScanInRange-instance'>
        ::<strong>backwardsScanInRange</strong>(regex, range, iterator)
      </a>
    </span>
    <span class='desc'>
      Scan regular expression matches in a given range in reverse order, calling the given iterator function on each match.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#beginTransaction-instance'>
        ::<strong>beginTransaction</strong>()
      </a>
    </span>
    <span class='desc'>
      Start an open-ended transaction.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#characterIndexForPosition-instance'>
        Number ::<strong>characterIndexForPosition</strong>(position)
      </a>
    </span>
    <span class='desc'>
      Convert a position in the buffer in row/column coordinates to an absolute character offset, inclusive of line ending characters.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#clearUndoStack-instance'>
        ::<strong>clearUndoStack</strong>()
      </a>
    </span>
    <span class='desc'>
      Clear the undo stack.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#clipPosition-instance'>
        Point ::<strong>clipPosition</strong>(position)
      </a>
    </span>
    <span class='desc'>
      Clip the given point so it is at a valid position in the buffer.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#clipRange-instance'>
        Range ::<strong>clipRange</strong>(range)
      </a>
    </span>
    <span class='desc'>
      Clip the given range so it starts and ends at valid positions.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#commitTransaction-instance'>
        ::<strong>commitTransaction</strong>()
      </a>
    </span>
    <span class='desc'>
      Commit an open-ended transaction started with <a href='TextBuffer.html#beginTransaction-instance'>::beginTransaction</a> and push it to the undo stack.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#constructor-instance'>
        ::<strong>constructor</strong>(params)
      </a>
    </span>
    <span class='desc'>
      Create a new buffer with the given params.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#delete-instance'>
        Range ::<strong>delete</strong>(range)
      </a>
    </span>
    <span class='desc'>
      Delete the text in the given range.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#deleteRow-instance'>
        Range ::<strong>deleteRow</strong>(row)
      </a>
    </span>
    <span class='desc'>
      Delete the line associated with a specified row.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#deleteRows-instance'>
        Range ::<strong>deleteRows</strong>(startRow, endRow)
      </a>
    </span>
    <span class='desc'>
      Delete the lines associated with the specified row range.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#findMarkers-instance'>
        Array ::<strong>findMarkers</strong>(params)
      </a>
    </span>
    <span class='desc'>
      Find markers conforming to the given parameters.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#getEndPosition-instance'>
        Point ::<strong>getEndPosition</strong>()
      </a>
    </span>
    <span class='desc'>
      Get the maximal position in the buffer, where new text would be appended.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#getFirstPosition-instance'>
        Point ::<strong>getFirstPosition</strong>()
      </a>
    </span>
    <span class='desc'>
      Get the first position in the buffer, which is always <code>[0, 0]</code>.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#getLastLine-instance'>
        String ::<strong>getLastLine</strong>()
      </a>
    </span>
    <span class='desc'>
      Get the text of the last line of the buffer, without its line ending.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#getLastRow-instance'>
        Number ::<strong>getLastRow</strong>()
      </a>
    </span>
    <span class='desc'>
      Get the last 0-indexed row in the buffer.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#getLineCount-instance'>
        Number ::<strong>getLineCount</strong>()
      </a>
    </span>
    <span class='desc'>
      Get the number of lines in the buffer.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#getLines-instance'>
        Array ::<strong>getLines</strong>()
      </a>
    </span>
    <span class='desc'>
      Get the text of all lines in the buffer, without their line endings.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#getMarker-instance'>
        Marker ::<strong>getMarker</strong>(id)
      </a>
    </span>
    <span class='desc'>
      Get an existing marker by its id.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#getMarkerCount-instance'>
        Number ::<strong>getMarkerCount</strong>()
      </a>
    </span>
    <span class='desc'>
      Get the number of markers in the buffer.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#getMarkers-instance'>
        Array ::<strong>getMarkers</strong>()
      </a>
    </span>
    <span class='desc'>
      Get all existing markers on the buffer.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#getMaxCharacterIndex-instance'>
        Number ::<strong>getMaxCharacterIndex</strong>()
      </a>
    </span>
    <span class='desc'>
      Get the length of the buffer in characters.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#getRange-instance'>
        Range ::<strong>getRange</strong>()
      </a>
    </span>
    <span class='desc'>
      Get the range spanning from <code>[0, 0]</code> to <a href='TextBuffer.html#getEndPosition-instance'>::getEndPosition</a>.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#getText-instance'>
        String ::<strong>getText</strong>()
      </a>
    </span>
    <span class='desc'>
      Get the entire text of the buffer.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#getTextInRange-instance'>
        String ::<strong>getTextInRange</strong>(range)
      </a>
    </span>
    <span class='desc'>
      Get the text in a range.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#getUri-instance'>
        String ::<strong>getUri</strong>()
      </a>
    </span>
    <span class='desc'>
      Get the path of the associated file.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#insert-instance'>
        Range ::<strong>insert</strong>(position, text, normalizeLineEndings)
      </a>
    </span>
    <span class='desc'>
      Insert text at the given position.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#isEmpty-instance'>
        Boolean ::<strong>isEmpty</strong>()
      </a>
    </span>
    <span class='desc'>
      Determine whether the buffer is empty.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#isInConflict-instance'>
        Boolean ::<strong>isInConflict</strong>()
      </a>
    </span>
    <span class='desc'>
      Determine if the in-memory contents of the buffer conflict with the on-disk contents of its associated file.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#isModified-instance'>
        Boolean ::<strong>isModified</strong>()
      </a>
    </span>
    <span class='desc'>
      Determine if the in-memory contents of the buffer differ from its contents on disk.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#isRowBlank-instance'>
        Boolean ::<strong>isRowBlank</strong>(row)
      </a>
    </span>
    <span class='desc'>
      Determine if the given row contains only whitespace.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#lineEndingForRow-instance'>
        String ::<strong>lineEndingForRow</strong>(row)
      </a>
    </span>
    <span class='desc'>
      Get the line ending for the given 0-indexed row.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#lineForRow-instance'>
        String ::<strong>lineForRow</strong>(row)
      </a>
    </span>
    <span class='desc'>
      Get the text of the line at the given row, without its line ending.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#lineLengthForRow-instance'>
        Number ::<strong>lineLengthForRow</strong>(row)
      </a>
    </span>
    <span class='desc'>
      Get the length of the line for the given 0-indexed row, without its line ending.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#markPosition-instance'>
        Marker ::<strong>markPosition</strong>(position, properties)
      </a>
    </span>
    <span class='desc'>
      Create a marker at the given position with no tail.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#markRange-instance'>
        Marker ::<strong>markRange</strong>(range, properties)
      </a>
    </span>
    <span class='desc'>
      Create a marker with the given range.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#nextNonBlankRow-instance'>
        Number ::<strong>nextNonBlankRow</strong>(startRow)
      </a>
    </span>
    <span class='desc'>
      Given a row, find the next row that&#39;s not blank.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#positionForCharacterIndex-instance'>
        Point ::<strong>positionForCharacterIndex</strong>(offset)
      </a>
    </span>
    <span class='desc'>
      Convert an absolute character offset, inclusive of newlines, to a position in the buffer in row/column coordinates.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#previousNonBlankRow-instance'>
        Number ::<strong>previousNonBlankRow</strong>(startRow)
      </a>
    </span>
    <span class='desc'>
      Given a row, find the first preceding row that&#39;s not blank.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#rangeForRow-instance'>
        Range ::<strong>rangeForRow</strong>(row, includeNewline)
      </a>
    </span>
    <span class='desc'>
      Get the range for the given row
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#redo-instance'>
        ::<strong>redo</strong>()
      </a>
    </span>
    <span class='desc'>
      Redo the last operation
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#reload-instance'>
        ::<strong>reload</strong>()
      </a>
    </span>
    <span class='desc'>
      Reload the buffer&#39;s contents from disk.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#replace-instance'>
        Number ::<strong>replace</strong>(regex, replacementText)
      </a>
    </span>
    <span class='desc'>
      Replace all regular expression matches in the entire buffer.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#save-instance'>
        ::<strong>save</strong>()
      </a>
    </span>
    <span class='desc'>
      Save the buffer.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#saveAs-instance'>
        ::<strong>saveAs</strong>(filePath)
      </a>
    </span>
    <span class='desc'>
      Save the buffer at a specific path.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#scan-instance'>
        ::<strong>scan</strong>(regex, iterator)
      </a>
    </span>
    <span class='desc'>
      Scan regular expression matches in the entire buffer, calling the given iterator function on each match.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#scanInRange-instance'>
        ::<strong>scanInRange</strong>(regex, range, iterator, reverse = false)
      </a>
    </span>
    <span class='desc'>
      Scan regular expression matches in a given range , calling the given iterator function on each match.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#setPath-instance'>
        ::<strong>setPath</strong>(filePath)
      </a>
    </span>
    <span class='desc'>
      Set the path for the buffer&#39;s associated file.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#setText-instance'>
        Range ::<strong>setText</strong>(text)
      </a>
    </span>
    <span class='desc'>
      Replace the entire contents of the buffer with the given text.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#setTextInRange-instance'>
        Range ::<strong>setTextInRange</strong>(range, text, normalizeLineEndings = true)
      </a>
    </span>
    <span class='desc'>
      Set the text in the given range.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#setTextViaDiff-instance'>
        ::<strong>setTextViaDiff</strong>(text)
      </a>
    </span>
    <span class='desc'>
      Replace the current buffer contents by applying a diff based on the given text.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#transact-instance'>
        ::<strong>transact</strong>(fn)
      </a>
    </span>
    <span class='desc'>
      Batch multiple operations as a single undo/redo step.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#undo-instance'>
        ::<strong>undo</strong>()
      </a>
    </span>
    <span class='desc'>
      Undo the last operation.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='TextBuffer.html#usesSoftTabs-instance'>
        Boolean ::<strong>usesSoftTabs</strong>()
      </a>
    </span>
    <span class='desc'>
      Determine if the buffer uses soft tabs.
    </span>
  </li>
</ul>
      <h2>Constructor Details</h2>
      <div class='methods'>
  <div class='method_details'>
    <p class='signature' id='constructor-instance'>
      ::<strong>constructor</strong>(params)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Create a new buffer with the given params.</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='type'>(String)</span>
      <span class='name'>params</span>
      &mdash;
      <span class='desc'>A <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a> of text or an <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object'>Object</a> with the following keys:</span>
    </li>
    <ul class='options'>
      <li>
        <span class='type'>(Boolean)</span>
        <span class='name'>load</span>
        &mdash;
        <span class='desc'>A <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean'>Boolean</a>, <code>true</code> to asynchronously load the buffer from disk after initialization.</span>
      </li>
      <li>
        <span class='type'>(String)</span>
        <span class='name'>text</span>
        &mdash;
        <span class='desc'>The initial <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a> text of the buffer.</span>
      </li>
    </ul>
  </ul>
</div>
  </div>
</div>
      <h2>Instance Method Details</h2>
      <div class='methods'>
  <div class='method_details'>
    <p class='signature' id='abortTransaction-instance'>
      ::<strong>abortTransaction</strong>()
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Abort an open transaction, undoing any operations performed so far within the transaction.</p>
</div>
<div class='tags'>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='append-instance'>
      Range ::<strong>append</strong>(text, normalizeLineEndings)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Append text to the end of the buffer.</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='type'>(String)</span>
      <span class='name'>text</span>
      &mdash;
      <span class='desc'>A <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a> representing the text text to append.</span>
    </li>
  </ul>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt><a href='Range.html'>Range</a></tt>)
      &mdash;
      <span class='desc'>Returns the <a href='Range.html'>Range</a> of the inserted text</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='backwardsScan-instance'>
      ::<strong>backwardsScan</strong>(regex, iterator)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Scan regular expression matches in the entire buffer in reverse order, calling the given iterator function on each match.</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='type'>(RegExp)</span>
      <span class='name'>regex</span>
      &mdash;
      <span class='desc'>A <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp'>RegExp</a> to search for.</span>
    </li>
    <li>
      <span class='name'>iterator -</span>
    </li>
    <li>
      <span class='type'>(Function)</span>
      <span class='name'>A {Function} that&#39;s called on each match with an {Object} containing the.</span>
    </li>
    <li>
      <span class='name'>following keys:</span>
    </li>
    <ul class='options'>
      <li>
        <span class='name'>match</span>
        &mdash;
        <span class='desc'>The current regular expression match.</span>
      </li>
      <li>
        <span class='type'>(String)</span>
        <span class='name'>matchText</span>
        &mdash;
        <span class='desc'>A <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a> with the text of the match.</span>
      </li>
      <li>
        <span class='type'>(Range)</span>
        <span class='name'>range</span>
        &mdash;
        <span class='desc'>The <a href='Range.html'>Range</a> of the match.</span>
      </li>
      <li>
        <span class='type'>(Function)</span>
        <span class='name'>stop</span>
        &mdash;
        <span class='desc'>Call this <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function'>Function</a> to terminate the scan.</span>
      </li>
      <li>
        <span class='type'>(Function)</span>
        <span class='name'>replace</span>
        &mdash;
        <span class='desc'>Call this <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function'>Function</a> with a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a> to replace the match.</span>
      </li>
    </ul>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='backwardsScanInRange-instance'>
      ::<strong>backwardsScanInRange</strong>(regex, range, iterator)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Scan regular expression matches in a given range in reverse order, calling the given iterator function on each match.</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='type'>(RegExp)</span>
      <span class='name'>regex</span>
      &mdash;
      <span class='desc'>A <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp'>RegExp</a> to search for.</span>
    </li>
    <li>
      <span class='type'>(Range)</span>
      <span class='name'>range</span>
      &mdash;
      <span class='desc'>A <a href='Range.html'>Range</a> in which to search.</span>
    </li>
    <li>
      <span class='name'>iterator -</span>
    </li>
    <li>
      <span class='type'>(Function)</span>
      <span class='name'>A {Function} that&#39;s called on each match with an {Object} containing the.</span>
    </li>
    <li>
      <span class='name'>following keys:</span>
    </li>
    <ul class='options'>
      <li>
        <span class='name'>match</span>
        &mdash;
        <span class='desc'>The current regular expression match.</span>
      </li>
      <li>
        <span class='type'>(String)</span>
        <span class='name'>matchText</span>
        &mdash;
        <span class='desc'>A <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a> with the text of the match.</span>
      </li>
      <li>
        <span class='type'>(Range)</span>
        <span class='name'>range</span>
        &mdash;
        <span class='desc'>The <a href='Range.html'>Range</a> of the match.</span>
      </li>
      <li>
        <span class='type'>(Function)</span>
        <span class='name'>stop</span>
        &mdash;
        <span class='desc'>Call this <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function'>Function</a> to terminate the scan.</span>
      </li>
      <li>
        <span class='type'>(Function)</span>
        <span class='name'>replace</span>
        &mdash;
        <span class='desc'>Call this <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function'>Function</a> with a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a> to replace the match.</span>
      </li>
    </ul>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='beginTransaction-instance'>
      ::<strong>beginTransaction</strong>()
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Start an open-ended transaction.</p><p>Call <a href='TextBuffer.html#commitTransaction-instance'>::commitTransaction</a> or <a href='TextBuffer.html#abortTransaction-instance'>::abortTransaction</a> to terminate the
transaction. If you nest calls to transactions, only the outermost
transaction is considered. You must match every begin with a matching
commit, but a single call to abort will cancel all nested transactions. </p>
</div>
<div class='tags'>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='characterIndexForPosition-instance'>
      Number ::<strong>characterIndexForPosition</strong>(position)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Convert a position in the buffer in row/column coordinates to an absolute character offset, inclusive of line ending characters.</p><p>The position is clipped prior to translating.</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='type'>(Point)</span>
      <span class='name'>position</span>
      &mdash;
      <span class='desc'>A <a href='Point.html'>Point</a>.</span>
    </li>
  </ul>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt>Number</tt>)
      &mdash;
      <span class='desc'>Returns a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number'>Number</a>.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='clearUndoStack-instance'>
      ::<strong>clearUndoStack</strong>()
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Clear the undo stack.</p>
</div>
<div class='tags'>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='clipPosition-instance'>
      Point ::<strong>clipPosition</strong>(position)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Clip the given point so it is at a valid position in the buffer.</p><p>For example, the position (1, 100) is out of bounds if the line at row 1 is
only 10 characters long, and it would be clipped to (1, 10)</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='type'>(Point)</span>
      <span class='name'>position</span>
      &mdash;
      <span class='desc'>A <a href='Point.html'>Point</a> or point-compatible <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array'>Array</a>.</span>
    </li>
  </ul>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt><a href='Point.html'>Point</a></tt>)
      &mdash;
      <span class='desc'>Returns a new <a href='Point.html'>Point</a> if the given position is invalid, otherwise returns
the given position.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='clipRange-instance'>
      Range ::<strong>clipRange</strong>(range)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Clip the given range so it starts and ends at valid positions.</p><p>For example, the position [1, 100] is out of bounds if the line at row 1 is
only 10 characters long, and it would be clipped to (1, 10).</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='type'>(Range)</span>
      <span class='name'>range</span>
      &mdash;
      <span class='desc'>A <a href='Range.html'>Range</a> or range-compatible <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array'>Array</a> to clip.</span>
    </li>
  </ul>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt><a href='Range.html'>Range</a></tt>)
      &mdash;
      <span class='desc'>Returns the given <a href='Range.html'>Range</a> if it is already in bounds, or a new clipped
<a href='Range.html'>Range</a> if the given range is out-of-bounds.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='commitTransaction-instance'>
      ::<strong>commitTransaction</strong>()
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Commit an open-ended transaction started with <a href='TextBuffer.html#beginTransaction-instance'>::beginTransaction</a> and push it to the undo stack.</p><p>If transactions are nested, only the outermost commit takes effect. </p>
</div>
<div class='tags'>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='delete-instance'>
      Range ::<strong>delete</strong>(range)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Delete the text in the given range.</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='type'>(Range)</span>
      <span class='name'>range</span>
      &mdash;
      <span class='desc'>A <a href='Range.html'>Range</a> in which to delete. The range is clipped before deleting.</span>
    </li>
  </ul>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt><a href='Range.html'>Range</a></tt>)
      &mdash;
      <span class='desc'>Returns an empty <a href='Range.html'>Range</a> starting at the start of deleted range.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='deleteRow-instance'>
      Range ::<strong>deleteRow</strong>(row)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Delete the line associated with a specified row.</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='type'>(Number)</span>
      <span class='name'>row</span>
      &mdash;
      <span class='desc'>A <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number'>Number</a> representing the 0-indexed row to delete.</span>
    </li>
  </ul>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt><a href='Range.html'>Range</a></tt>)
      &mdash;
      <span class='desc'>Returns the <a href='Range.html'>Range</a> of the deleted text.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='deleteRows-instance'>
      Range ::<strong>deleteRows</strong>(startRow, endRow)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Delete the lines associated with the specified row range.</p><p>If the row range is out of bounds, it will be clipped. If the startRow is
greater than the end row, they will be reordered.</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='type'>(Number)</span>
      <span class='name'>startRow</span>
      &mdash;
      <span class='desc'>A <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number'>Number</a> representing the first row to delete.</span>
    </li>
    <li>
      <span class='type'>(Number)</span>
      <span class='name'>endRow</span>
      &mdash;
      <span class='desc'>A <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number'>Number</a> representing the last row to delete, inclusive.</span>
    </li>
  </ul>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt><a href='Range.html'>Range</a></tt>)
      &mdash;
      <span class='desc'>Returns the <a href='Range.html'>Range</a> of the deleted text.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='findMarkers-instance'>
      Array ::<strong>findMarkers</strong>(params)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Find markers conforming to the given parameters.</p><p>:params -
A hash of key-value pairs constraining the set of returned markers. You
can query against custom marker properties by listing the desired
key-value pairs here. In addition, the following keys are reserved and
have special semantics:</p><ul>
<li>&#39;startPosition&#39;: Only include markers that start at the given <a href='Point.html'>Point</a>.</li>
<li>&#39;endPosition&#39;: Only include markers that end at the given <a href='Point.html'>Point</a>.</li>
<li>&#39;containsPoint&#39;: Only include markers that contain the given <a href='Point.html'>Point</a>, inclusive.</li>
<li>&#39;containsRange&#39;: Only include markers that contain the given <a href='Range.html'>Range</a>, inclusive.</li>
<li>&#39;startRow&#39;: Only include markers that start at the given row <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number'>Number</a>.</li>
<li>&#39;endRow&#39;: Only include markers that end at the given row <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number'>Number</a>.</li>
<li>&#39;intersectsRow&#39;: Only include markers that intersect the given row <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number'>Number</a>.</li>
</ul><p>Finds markers that conform to all of the given parameters. Markers are
sorted based on their position in the buffer. If two markers start at the
same position, the larger marker comes first.</p>
</div>
<div class='tags'>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt>Array</tt>)
      &mdash;
      <span class='desc'>Returns an <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array'>Array</a> of <a href='Marker.html'>Marker</a>s.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='getEndPosition-instance'>
      Point ::<strong>getEndPosition</strong>()
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Get the maximal position in the buffer, where new text would be appended.</p>
</div>
<div class='tags'>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt><a href='Point.html'>Point</a></tt>)
      &mdash;
      <span class='desc'>Returns a <a href='Point.html'>Point</a>.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='getFirstPosition-instance'>
      Point ::<strong>getFirstPosition</strong>()
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Get the first position in the buffer, which is always <code>[0, 0]</code>.</p>
</div>
<div class='tags'>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt><a href='Point.html'>Point</a></tt>)
      &mdash;
      <span class='desc'>Returns a <a href='Point.html'>Point</a>.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='getLastLine-instance'>
      String ::<strong>getLastLine</strong>()
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Get the text of the last line of the buffer, without its line ending.</p>
</div>
<div class='tags'>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt>String</tt>)
      &mdash;
      <span class='desc'>Returns a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a>.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='getLastRow-instance'>
      Number ::<strong>getLastRow</strong>()
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Get the last 0-indexed row in the buffer.</p>
</div>
<div class='tags'>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt>Number</tt>)
      &mdash;
      <span class='desc'>Returns a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number'>Number</a>.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='getLineCount-instance'>
      Number ::<strong>getLineCount</strong>()
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Get the number of lines in the buffer.</p>
</div>
<div class='tags'>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt>Number</tt>)
      &mdash;
      <span class='desc'>Returns a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number'>Number</a>.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='getLines-instance'>
      Array ::<strong>getLines</strong>()
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Get the text of all lines in the buffer, without their line endings.</p>
</div>
<div class='tags'>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt>Array</tt>)
      &mdash;
      <span class='desc'>Returns an <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array'>Array</a> of <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a>s.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='getMarker-instance'>
      Marker ::<strong>getMarker</strong>(id)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Get an existing marker by its id.</p>
</div>
<div class='tags'>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt><a href='Marker.html'>Marker</a></tt>)
      &mdash;
      <span class='desc'>Returns a <a href='Marker.html'>Marker</a>.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='getMarkerCount-instance'>
      Number ::<strong>getMarkerCount</strong>()
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Get the number of markers in the buffer.</p>
</div>
<div class='tags'>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt>Number</tt>)
      &mdash;
      <span class='desc'>Returns a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number'>Number</a>.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='getMarkers-instance'>
      Array ::<strong>getMarkers</strong>()
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Get all existing markers on the buffer.</p>
</div>
<div class='tags'>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt>Array</tt>)
      &mdash;
      <span class='desc'>Returns an <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array'>Array</a> of <a href='Marker.html'>Marker</a>s.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='getMaxCharacterIndex-instance'>
      Number ::<strong>getMaxCharacterIndex</strong>()
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Get the length of the buffer in characters.</p>
</div>
<div class='tags'>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt>Number</tt>)
      &mdash;
      <span class='desc'>Returns a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number'>Number</a>.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='getRange-instance'>
      Range ::<strong>getRange</strong>()
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Get the range spanning from <code>[0, 0]</code> to <a href='TextBuffer.html#getEndPosition-instance'>::getEndPosition</a>.</p>
</div>
<div class='tags'>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt><a href='Range.html'>Range</a></tt>)
      &mdash;
      <span class='desc'>Returns a <a href='Range.html'>Range</a>.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='getText-instance'>
      String ::<strong>getText</strong>()
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Get the entire text of the buffer.</p>
</div>
<div class='tags'>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt>String</tt>)
      &mdash;
      <span class='desc'>Returns a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a>.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='getTextInRange-instance'>
      String ::<strong>getTextInRange</strong>(range)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Get the text in a range.</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='type'>(Range)</span>
      <span class='name'>range</span>
      &mdash;
      <span class='desc'>A <a href='Range.html'>Range</a></span>
    </li>
  </ul>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt>String</tt>)
      &mdash;
      <span class='desc'>Returns a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a></span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='getUri-instance'>
      String ::<strong>getUri</strong>()
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Get the path of the associated file.</p>
</div>
<div class='tags'>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt>String</tt>)
      &mdash;
      <span class='desc'>Returns a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a>.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='insert-instance'>
      Range ::<strong>insert</strong>(position, text, normalizeLineEndings)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Insert text at the given position.</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='type'>(Point)</span>
      <span class='name'>position</span>
      &mdash;
      <span class='desc'>A <a href='Point.html'>Point</a> representing the insertion location. The position is clipped before insertion.</span>
    </li>
    <li>
      <span class='type'>(String)</span>
      <span class='name'>text</span>
      &mdash;
      <span class='desc'>A <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a> representing the text to insert.</span>
    </li>
  </ul>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt><a href='Range.html'>Range</a></tt>)
      &mdash;
      <span class='desc'>Returns the <a href='Range.html'>Range</a> of the inserted text.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='isEmpty-instance'>
      Boolean ::<strong>isEmpty</strong>()
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Determine whether the buffer is empty.</p>
</div>
<div class='tags'>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt>Boolean</tt>)
      &mdash;
      <span class='desc'>Returns a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean'>Boolean</a>.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='isInConflict-instance'>
      Boolean ::<strong>isInConflict</strong>()
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Determine if the in-memory contents of the buffer conflict with the on-disk contents of its associated file.</p>
</div>
<div class='tags'>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt>Boolean</tt>)
      &mdash;
      <span class='desc'>Returns a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean'>Boolean</a>.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='isModified-instance'>
      Boolean ::<strong>isModified</strong>()
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Determine if the in-memory contents of the buffer differ from its contents on disk.</p><p>If the buffer is unsaved, always returns <code>true</code> unless the buffer is empty.</p>
</div>
<div class='tags'>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt>Boolean</tt>)
      &mdash;
      <span class='desc'>Returns a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean'>Boolean</a>.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='isRowBlank-instance'>
      Boolean ::<strong>isRowBlank</strong>(row)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Determine if the given row contains only whitespace.</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='type'>(Number)</span>
      <span class='name'>row</span>
      &mdash;
      <span class='desc'>A <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number'>Number</a> representing a 0-indexed row.</span>
    </li>
  </ul>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt>Boolean</tt>)
      &mdash;
      <span class='desc'>Returns a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean'>Boolean</a>.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='lineEndingForRow-instance'>
      String ::<strong>lineEndingForRow</strong>(row)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Get the line ending for the given 0-indexed row.</p><p>The returned newline is represented as a literal string: <code>&#39;\n&#39;</code>, <code>&#39;\r\n&#39;</code>,
or <code>&#39;&#39;</code> for the last line of the buffer, which doesn&#39;t end in a newline.</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='type'>(Number)</span>
      <span class='name'>row</span>
      &mdash;
      <span class='desc'>A <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number'>Number</a> indicating the row.</span>
    </li>
  </ul>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt>String</tt>)
      &mdash;
      <span class='desc'>Returns a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a>.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='lineForRow-instance'>
      String ::<strong>lineForRow</strong>(row)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Get the text of the line at the given row, without its line ending.</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='type'>(Number)</span>
      <span class='name'>row</span>
      &mdash;
      <span class='desc'>A <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number'>Number</a> representing a 0-indexed row.</span>
    </li>
  </ul>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt>String</tt>)
      &mdash;
      <span class='desc'>Returns a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a>.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='lineLengthForRow-instance'>
      Number ::<strong>lineLengthForRow</strong>(row)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Get the length of the line for the given 0-indexed row, without its line ending.</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='type'>(Number)</span>
      <span class='name'>row</span>
      &mdash;
      <span class='desc'>A <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number'>Number</a> indicating the row.</span>
    </li>
  </ul>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt>Number</tt>)
      &mdash;
      <span class='desc'>Returns a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number'>Number</a>.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='markPosition-instance'>
      Marker ::<strong>markPosition</strong>(position, properties)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Create a marker at the given position with no tail.</p><p>:position - <a href='Point.html'>Point</a> or point-compatible <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array'>Array</a>
:properties - This is the same as the <code>properties</code> parameter in <a href='TextBuffer.html#markRange-instance'>::markRange</a></p>
</div>
<div class='tags'>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt><a href='Marker.html'>Marker</a></tt>)
      &mdash;
      <span class='desc'>Returns a <a href='Marker.html'>Marker</a>.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='markRange-instance'>
      Marker ::<strong>markRange</strong>(range, properties)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Create a marker with the given range. This marker will maintain its logical location as the buffer is changed, so if you mark a particular word, the marker will remain over that word even if the word&#39;s location in the buffer changes.</p><ul>
<li>range: A <a href='Range.html'>Range</a> or range-compatible <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array'>Array</a></li>
<li>properties:
A hash of key-value pairs to associate with the marker. There are also
reserved property names that have marker-specific meaning:
  :reversed -<pre><code>Creates the marker in a reversed orientation. Defaults to false.
</code></pre>  :persistent -<pre><code>Whether to include this marker when serializing the buffer. Defaults
to true.
</code></pre>  :invalidate -<pre><code>Determines the rules by which changes to the buffer *invalidate* the
marker. Defaults to &#39;overlap&#39;, but can be any of the following:
* &#39;never&#39;:
    The marker is never marked as invalid. This is a good choice for
    markers representing selections in an editor.
* &#39;surround&#39;:
    The marker is invalidated by changes that completely surround it.
* &#39;overlap&#39;:
    The marker is invalidated by changes that surround the start or
    end of the marker. This is the default.
* &#39;inside&#39;:
    The marker is invalidated by a change that touches the marked
    region in any way. This is the most fragile strategy.
</code></pre></li>
</ul>

</div>
<div class='tags'>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt><a href='Marker.html'>Marker</a></tt>)
      &mdash;
      <span class='desc'>Returns a <a href='Marker.html'>Marker</a>.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='nextNonBlankRow-instance'>
      Number ::<strong>nextNonBlankRow</strong>(startRow)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Given a row, find the next row that&#39;s not blank.</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='type'>(Number)</span>
      <span class='name'>startRow</span>
      &mdash;
      <span class='desc'>A <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number'>Number</a> identifying the row to start checking at.</span>
    </li>
  </ul>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt>Number</tt>)
      &mdash;
      <span class='desc'>Returns a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number'>Number</a> or <code>null</code> if there&#39;s no next non-blank row.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='positionForCharacterIndex-instance'>
      Point ::<strong>positionForCharacterIndex</strong>(offset)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Convert an absolute character offset, inclusive of newlines, to a position in the buffer in row/column coordinates.</p><p>The offset is clipped prior to translating.</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='type'>(Number)</span>
      <span class='name'>offset</span>
      &mdash;
      <span class='desc'>A <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number'>Number</a>.</span>
    </li>
  </ul>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt><a href='Point.html'>Point</a></tt>)
      &mdash;
      <span class='desc'>Returns a <a href='Point.html'>Point</a>.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='previousNonBlankRow-instance'>
      Number ::<strong>previousNonBlankRow</strong>(startRow)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Given a row, find the first preceding row that&#39;s not blank.</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='type'>(Number)</span>
      <span class='name'>startRow</span>
      &mdash;
      <span class='desc'>A <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number'>Number</a> identifying the row to start checking at.</span>
    </li>
  </ul>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt>Number</tt>)
      &mdash;
      <span class='desc'>Returns a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number'>Number</a> or <code>null</code> if there&#39;s no preceding non-blank row.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='rangeForRow-instance'>
      Range ::<strong>rangeForRow</strong>(row, includeNewline)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Get the range for the given row</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='type'>(Number)</span>
      <span class='name'>row</span>
      &mdash;
      <span class='desc'>A <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number'>Number</a> representing a 0-indexed row.</span>
    </li>
    <li>
      <span class='type'>(Boolean)</span>
      <span class='name'>includeNewline</span>
      &mdash;
      <span class='desc'>A <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean'>Boolean</a> indicating whether or not to include the newline, which results in a range that extends to the start of the next line.</span>
    </li>
  </ul>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt><a href='Range.html'>Range</a></tt>)
      &mdash;
      <span class='desc'>Returns a <a href='Range.html'>Range</a>.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='redo-instance'>
      ::<strong>redo</strong>()
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Redo the last operation</p>
</div>
<div class='tags'>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='reload-instance'>
      ::<strong>reload</strong>()
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Reload the buffer&#39;s contents from disk.</p><p>Sets the buffer&#39;s content to the cached disk contents </p>
</div>
<div class='tags'>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='replace-instance'>
      Number ::<strong>replace</strong>(regex, replacementText)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Replace all regular expression matches in the entire buffer.</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='type'>(RegExp)</span>
      <span class='name'>regex</span>
      &mdash;
      <span class='desc'>A <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp'>RegExp</a> representing the matches to be replaced.</span>
    </li>
    <li>
      <span class='type'>(String)</span>
      <span class='name'>replacementText</span>
      &mdash;
      <span class='desc'>A <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a> representing the text to replace each match.</span>
    </li>
  </ul>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt>Number</tt>)
      &mdash;
      <span class='desc'>Returns a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number'>Number</a> representing the number of replacements made.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='save-instance'>
      ::<strong>save</strong>()
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Save the buffer.</p>
</div>
<div class='tags'>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='saveAs-instance'>
      ::<strong>saveAs</strong>(filePath)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Save the buffer at a specific path.</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='name'>filePath</span>
      &mdash;
      <span class='desc'>The path to save at.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='scan-instance'>
      ::<strong>scan</strong>(regex, iterator)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Scan regular expression matches in the entire buffer, calling the given iterator function on each match.</p><p>If you&#39;re programmatically modifying the results, you may want to try
<a href='TextBuffer.html#backwardsScan-instance'>::backwardsScan</a> to avoid tripping over your own changes.</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='type'>(RegExp)</span>
      <span class='name'>regex</span>
      &mdash;
      <span class='desc'>A <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp'>RegExp</a> to search for.</span>
    </li>
    <li>
      <span class='name'>iterator -</span>
    </li>
    <li>
      <span class='type'>(Function)</span>
      <span class='name'>A {Function} that&#39;s called on each match with an {Object} containing the.</span>
    </li>
    <li>
      <span class='name'>following keys:</span>
    </li>
    <ul class='options'>
      <li>
        <span class='name'>match</span>
        &mdash;
        <span class='desc'>The current regular expression match.</span>
      </li>
      <li>
        <span class='type'>(String)</span>
        <span class='name'>matchText</span>
        &mdash;
        <span class='desc'>A <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a> with the text of the match.</span>
      </li>
      <li>
        <span class='type'>(Range)</span>
        <span class='name'>range</span>
        &mdash;
        <span class='desc'>The <a href='Range.html'>Range</a> of the match.</span>
      </li>
      <li>
        <span class='type'>(Function)</span>
        <span class='name'>stop</span>
        &mdash;
        <span class='desc'>Call this <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function'>Function</a> to terminate the scan.</span>
      </li>
      <li>
        <span class='type'>(Function)</span>
        <span class='name'>replace</span>
        &mdash;
        <span class='desc'>Call this <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function'>Function</a> with a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a> to replace the match.</span>
      </li>
    </ul>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='scanInRange-instance'>
      ::<strong>scanInRange</strong>(regex, range, iterator, reverse = false)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Scan regular expression matches in a given range , calling the given iterator function on each match.</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='type'>(RegExp)</span>
      <span class='name'>regex</span>
      &mdash;
      <span class='desc'>A <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp'>RegExp</a> to search for.</span>
    </li>
    <li>
      <span class='type'>(Range)</span>
      <span class='name'>range</span>
      &mdash;
      <span class='desc'>A <a href='Range.html'>Range</a> in which to search.</span>
    </li>
    <li>
      <span class='name'>iterator -</span>
    </li>
    <li>
      <span class='type'>(Function)</span>
      <span class='name'>A {Function} that&#39;s called on each match with an {Object} containing the.</span>
    </li>
    <li>
      <span class='name'>following keys:</span>
    </li>
    <ul class='options'>
      <li>
        <span class='name'>match</span>
        &mdash;
        <span class='desc'>The current regular expression match.</span>
      </li>
      <li>
        <span class='type'>(String)</span>
        <span class='name'>matchText</span>
        &mdash;
        <span class='desc'>A <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a> with the text of the match.</span>
      </li>
      <li>
        <span class='type'>(Range)</span>
        <span class='name'>range</span>
        &mdash;
        <span class='desc'>The <a href='Range.html'>Range</a> of the match.</span>
      </li>
      <li>
        <span class='type'>(Function)</span>
        <span class='name'>stop</span>
        &mdash;
        <span class='desc'>Call this <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function'>Function</a> to terminate the scan.</span>
      </li>
      <li>
        <span class='type'>(Function)</span>
        <span class='name'>replace</span>
        &mdash;
        <span class='desc'>Call this <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function'>Function</a> with a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a> to replace the match.</span>
      </li>
    </ul>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='setPath-instance'>
      ::<strong>setPath</strong>(filePath)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Set the path for the buffer&#39;s associated file.</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='type'>(String)</span>
      <span class='name'>filePath</span>
      &mdash;
      <span class='desc'>A <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a> representing the new file path</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='setText-instance'>
      Range ::<strong>setText</strong>(text)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Replace the entire contents of the buffer with the given text.</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='type'>(String)</span>
      <span class='name'>text</span>
      &mdash;
      <span class='desc'>A <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a></span>
    </li>
  </ul>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt><a href='Range.html'>Range</a></tt>)
      &mdash;
      <span class='desc'>Returns a <a href='Range.html'>Range</a> spanning the new buffer contents.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='setTextInRange-instance'>
      Range ::<strong>setTextInRange</strong>(range, text, normalizeLineEndings = true)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Set the text in the given range.</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='type'>(Range)</span>
      <span class='name'>range</span>
      &mdash;
      <span class='desc'>A <a href='Range.html'>Range</a>.</span>
    </li>
    <li>
      <span class='type'>(String)</span>
      <span class='name'>text</span>
      &mdash;
      <span class='desc'>A <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a>.</span>
    </li>
  </ul>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt><a href='Range.html'>Range</a></tt>)
      &mdash;
      <span class='desc'>Returns the <a href='Range.html'>Range</a> of the inserted text.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='setTextViaDiff-instance'>
      ::<strong>setTextViaDiff</strong>(text)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Replace the current buffer contents by applying a diff based on the given text.</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='type'>(String)</span>
      <span class='name'>text</span>
      &mdash;
      <span class='desc'>A <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a> containing the new buffer contents.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='transact-instance'>
      ::<strong>transact</strong>(fn)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Batch multiple operations as a single undo/redo step.</p><p>Any group of operations that are logically grouped from the perspective of
undoing and redoing should be performed in a transaction. If you want to
abort the transaction, call <a href='TextBuffer.html#abortTransaction-instance'>::abortTransaction</a> to terminate the function&#39;s
execution and revert any changes performed up to the abortion.</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='type'>(Function)</span>
      <span class='name'>fn</span>
      &mdash;
      <span class='desc'>A <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function'>Function</a> to call inside the transaction.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='undo-instance'>
      ::<strong>undo</strong>()
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Undo the last operation. If a transaction is in progress, aborts it.</p>
</div>
<div class='tags'>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='usesSoftTabs-instance'>
      Boolean ::<strong>usesSoftTabs</strong>()
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Determine if the buffer uses soft tabs.</p>
</div>
<div class='tags'>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt>Boolean</tt>)
      &mdash;
      <span class='desc'>Returns a <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean'>Boolean</a>,</span>
    </li>
  </ul>
</div>
  </div>
</div>
    </div>
    <div id='footer'>
  Generated on
  Wed Mar 05 2014 08:55:13 GMT-0700 (MST)
  by
  <a href='https://github.com/gjtorikian/biscotto' title='TomDoc-CoffeeScript API documentation generator'>Biscotto</a>
  v2.1.1
  (Node.js v0.10.22).
  &#10034;
  Press Ctrl-h to see the keyboard shortcuts
</div>
  </body>
</html>